package com.snda.sc.store;

import java.sql.Timestamp;

import com.snda.sc.auth.AuthResult;
import com.snda.sc.utils.CommonUtils;
import com.snda.sc.utils.ToStringHelper;

/**
 * 登陆记录。
 * 
 * @author <a href="mailto:seenoevil.cn@gmail.com">李曦</a><br/>
 *         Created at: 2012-9-28 下午3:31:09
 */
public class LoginRecord {

	// 第三方平台ID
	private String plt;
	// 第三方平台ID
	private String snsUid;
	// 用户ID（HPS生成的影子数字账号）
	private String uid;
	// 盛大通行证
	private String pt;
	// 登陆时间
	private Timestamp time = new Timestamp(System.currentTimeMillis());
	// 应用名称
	private String appName;

	public LoginRecord() {
	}

	public LoginRecord(AuthResult result) {
		this.plt = result.getPlt();
		this.snsUid = result.getSnsUid();
		this.uid = result.getUid();
		this.pt = result.getPt();
		this.appName = result.getAppName();
	}

	public LoginRecord(String plt, String snsUid, String uid, String pt, String appName) {
		this.plt = plt;
		this.snsUid = snsUid;
		this.uid = uid;
		this.pt = pt;
		this.appName = appName;
	}

	public String getPlt() {
		return plt;
	}

	public void setPlt(String plt) {
		this.plt = plt;
	}

	public String getSnsUid() {
		return snsUid;
	}

	public void setSnsUid(String snsUid) {
		this.snsUid = snsUid;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getPt() {
		return pt;
	}

	public void setPt(String pt) {
		this.pt = pt;
	}

	public Timestamp getTime() {
		return time;
	}

	public void setTime(Timestamp time) {
		this.time = time;
	}

	public String getAppName() {
		return appName;
	}

	public void setAppName(String appName) {
		this.appName = appName;
	}

	@Override
	public String toString() {
		ToStringHelper helper = new ToStringHelper(LoginRecord.class);
		helper.append("plt", plt);
		helper.append("snsUid", snsUid);
		helper.append("uid", uid);
		helper.append("pt", pt);
		helper.append("time", CommonUtils.formatTime());
		helper.append("appName", appName);
		return helper.toString();
	}
}
